package com.liuyang.demo.scanpackage;

import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.core.type.filter.RegexPatternTypeFilter;

import java.util.Set;
import java.util.regex.Pattern;

public class ClassScannerDemo {
    public static void main(String[] args) {
        Class interfaceClazz = IAnimal.class;
        ClassScanner classScanner = new ClassScanner();
        classScanner.addIncludeFilter(new AssignableTypeFilter(interfaceClazz));
        classScanner.addExcludeFilter(new RegexPatternTypeFilter(Pattern.compile(interfaceClazz.getName())));
        Set<Class<?>> scan = classScanner.scan("com.liuyang.demo.reflect");
        System.out.println(scan.size());
    }
}
